/*******************************************************************************
 * Name    : AbstractTestClass.hpp
 * Date    : 01-17-2014
 * Author  : Sylvain Nieuwlandt -- nicholas.rush.developper@gmail.com
 ******************************************************************************/

#ifndef ABSTRACTTESTCLASS_HPP
#define ABSTRACTTESTCLASS_HPP

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <kino/KiBoolean.hpp>

class AbstractTestClass {
public:
  AbstractTestClass();
  virtual ~AbstractTestClass();
  virtual const char* getClassName();
  virtual bool isFailed();
  virtual char* getErrors();
  
  virtual void run()     = 0;

protected:
  const char* m_className;

  void assertNotNull(void* obj, 
		     const char* testMethod, 
		     const char* errorMessage);
  void assertFalse(KiBoolean value,
		     const char* testMethod, 
		     const char* errorMessage);
  void assertTrue(KiBoolean value,
		     const char* testMethod, 
		     const char* errorMessage);
  void assertFalse(bool value,
		     const char* testMethod, 
		     const char* errorMessage);
  void assertTrue(bool value,
		     const char* testMethod, 
		     const char* errorMessage);


private:
  char* m_errors;
  bool m_testFailure;

  void writeError(const char* testMethod, const char* errorMessage);
  
};

#endif    
